<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

    protected function _initDoctrine() {


        $this->getApplication()->getAutoloader()
                ->pushAutoloader(array('Doctrine', 'autoload'));

        spl_autoload_register(array('Doctrine', 'modelsAutoload'));
        $manager = Doctrine_Manager::getInstance();

        $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, TRUE);
        $manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, TRUE);
        $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);

        $doctrineConfig = new Zend_Config_Ini(APPLICATION_PATH . "/configs/database.ini", 'development');

        Doctrine::loadModels($doctrineConfig->doctrine->models_path);


        $conn = Doctrine_Manager::connection($doctrineConfig->doctrine->dsn, 'doctrine');
        $conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, TRUE);
        
        return $conn;
    }

}

